﻿#region

using System.Collections.Generic;
using System.Linq;
using Ink_Master.Bots.InkMaster.BagHandlers;
using Ink_Master.Bots.InkMaster.Objects;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

#endregion

namespace Ink_Master.Bots.InkMaster.InfoBuilders
{
    public static class CheckStatus
    {
        /// <summary>
        ///   Checks to see if we are done
        /// </summary>
        /// <param name = "icollectionInfo">The icollection info.</param>
        /// <param name = "sortbags">if set to <c>true</c> [sortbags].</param>
        /// <returns></returns>
        public static bool AreWeDone(InkCollector.InkCollectionInfo icollectionInfo, bool sortbags)
        {
            ObjectManager.Update();
            string inkrequired = icollectionInfo.Ink;
            if (string.IsNullOrEmpty(inkrequired))
            {
                return false;
            }
            int qtyrequired = icollectionInfo.InkQty;
            if (sortbags)
            {
                WoWMovement.MoveStop();
                Log.Slog("Sorting bags.");
                Sorting.SortBags();
            }
            Log.Slog("Checking if we are done: " + (Search.GetInkQty(inkrequired) == qtyrequired));
            return Search.GetInkQty(inkrequired) == qtyrequired;
        }

        /// <summary>
        ///   Checks to see if we have any Pigments to deal with
        /// </summary>
        /// <returns></returns>
        public static bool PigmentsToChurn()
        {
            ObjectManager.Update();
            Log.Slog("Entered Pigments to Ink Check");
            List<WoWItem> pigments = Search.GetPigments();
            Log.Slog(pigments.Count.ToString());
            Log.Slog("Checking if we have pigments to churn: " + (pigments.Count >= 2));
            return pigments.Count >= 2;
        }

        /// <summary>
        ///   Checks to see if we have any Herbs to Mill
        /// </summary>
        /// <returns></returns>
        public static bool HerbsToMIll()
        {
            ObjectManager.Update();
            Log.Slog("Entered Herbs To Mill Check");
            List<WoWItem> herbs = Search.GetHerbs();
            Log.Slog("Checking if we have herbs to mill: " + herbs.Any());
            return herbs.Any();
        }
    }
}